<html>
<head>
	<title> System Management & Security </title>
	<link rel="stylesheet" type="text/css" href="css/html.css">
	<link rel="stylesheet" type="text/css" href="css/docbook.css">
	<link rel="stylesheet" type="text/css" href="css/syntax.css">
</head>


<body>
<h1> 3 Basic Commands </h1>

<div class="TOC">
<dl>
	<dt><b>Table of Contents</b></dt>
	<dt>3.1  <a href="chapter3.html#COMMAND_CP">		The command cp		</a></dt>
	<dt>3.2  <a href="chapter3.html#COMMAND_RM">		The command rm		</a></dt>
	<dt>3.3  <a href="chapter3.html#COMMAND_MV">		The command mv		</a></dt>
	<dt>3.4  <a href="chapter3.html#COMMAND_CAT">		The command cat		</a></dt>
	<dt>3.5  <a href="chapter3.html#COMMAND_MORE">		The command more	</a></dt>
	<dt>3.6  <a href="chapter3.html#COMMAND_LESS">		The command less	</a></dt>
	<dt>3.7  <a href="chapter3.html#COMMAND_GZIP">		The command gzip	</a></dt>
	<dt>3.8  <a href="chapter3.html#COMMAND_BZIP2">		The command bzip2	</a></dt>
	<dt>3.9  <a href="chapter3.html#COMMAND_TAR">		The command tar		</a></dt>
	<dt>3.10 <a href="chapter3.html#COMMAND_HEAD">		The command head	</a></dt>
	<dt>3.11 <a href="chapter3.html#COMMAND_TAIL">		The command tail	</a></dt>
</dl>
</div>

<!------------------ 3 Basic Commands ---------------------------------------->

<div class="SECT1">
<h2 class="SECT1"><a id="COMMAND_CP" name="COMMAND_CP">3.1 The command cp</a></h2>
<p>
The command cp copies the content of the source file to the target. If the target is not a directory, the utility 
creates a new file with a copy of the content of the source file. If the target is a directory, it is possible to
copy several files to this directory.<br> 
<a href="http://www.freebsd.org/cgi/man.cgi?query=cp&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 1: Simple example for the usage of the command cp</b></p>
<div class="CODELISTING">
  <pre>
  cp <tt class="FILENAME">source_file target_file                                   </tt>
  cp <tt class="FILENAME">source_file_1 source_file_2 source_file_n target_directory/</tt>
  </pre>
</div>
</div>


<div class="SECT2">
<h2 class="SECT2"><a id="COMMAND_RM" name="COMMAND_RM">3.2 The command rm</a></h2>
<p>
The rm utility removes non-directory files if you have write permissions on these files.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=rm&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 2: Simple example for the usage of the command rm</b></p>
<div class="CODELISTING">
  <pre>
  rm <tt class="FILENAME">victim_file_1 victim_file_2 victim_file_n</tt>
  </pre>
</div>
</div>


<div class="SECT3">
<h2 class="SECT3"><a id="COMMAND_MV" name="COMMAND_MV">3.3 The command mv</a></h2>
<p>
mv moves a file to an existing directory or renames it.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=mv&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 3: Simple example for the usage of the command rm</b></p>
<div class="CODELISTING">
  <pre>
  mv <tt class="FILENAME">old_file_name new_file_name</tt>
  mv <tt class="FILENAME">file target_directory/</tt>
  </pre>
</div>
</div>


<div class="SECT4">
<h2 class="SECT4"><a id="COMMAND_CAT" name="COMMAND_CAT">3.4 The command cat</a></h2>
<p>
The cat utility reads files sequentially, writing them to the standard output. The given files are processed in command-line order.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=cat&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 4: Simple example for the usage of the command cat</b></p>
<div class="CODELISTING">
  <pre>
  cat <tt class="FILENAME"> file_1 file_2 file_n </tt>
  </pre>
</div>
</div>


<div class="SECT5">
<h2 class="SECT5"><a id="COMMAND_MORE" name="COMMAND_MORE">3.5 The command more</a></h2>
<p>
more is a filter for paging through text one screenful at a time. Backward moevement is not allowed.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=more&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 5: Simple example for the usage of the command more</b></p>
<div class="CODELISTING">
  <pre>
  more <tt class="FILENAME">file</tt>
  </pre>
</div>
</div>
      

<div class="SECT6">
<h2 class="SECT6"><a id="COMMAND_LESS" name="COMMAND_LESS">3.6 The command less</a></h2>
<p>
The utility less is similiar to more, but it allows backward movement.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=less&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 6: Simple example for the usage of the command less</b></p>
<div class="CODELISTING">
  <pre>
  less <tt class="FILENAME">file</tt>
  </pre>
</div>
</div>
                 

<div class="SECT7">
<h2 class="SECT7"><a id="COMMAND_GZIP" name="COMMAND_GZIP">3.7 The command gzip</a></h2>
<p>
The gzip program compresses and decompresses files using Lempel-Ziv coding (LZ77).<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=gzip&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 7: Simple example for the usage of the commands gzip and gunzip</b></p>
<div class="CODELISTING">
  <pre>
  gzip   <tt class="FILENAME">file   </tt> # compresses   file
  gunzip <tt class="FILENAME">file.gz</tt> # decompresses file.gz
  </pre>
</div>
</div>


<div class="SECT8">
<h2 class="SECT8"><a id="COMMAND_BZIP2" name="COMMAND_BZIP2">3.8 The command bzip2</a></h2>
<p>
bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding.   
Compression is generally considerably better than that achieved by gzip.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=bzip2&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 8: Simple example for the usage of the commands bzip2 and bunzip2</b></p>
<div class="CODELISTING">
  <pre>
  bzip2   <tt class="FILENAME">file    </tt> # compresses   file
  bunzip2 <tt class="FILENAME">file.bz2</tt> # decompresses file.gz
  </pre>
</div>
</div>


<div class="SECT9">
<h2 class="SECT9"><a id="COMMAND_TAR" name="COMMAND_TAR">3.9 The command tar</a></h2>
<p>
tar creates and manipulates streaming archive files.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=tar&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 9: Simple example for the usage of the command tar</b></p>
<div class="CODELISTING">
  <pre>
  tar -cf <tt class="FILENAME">target.tar source_file</tt> # creates  archive
  tar -xf <tt class="FILENAME">target.tar            </tt> # extracts archiv
  </pre>
</div>
</div>


<div class="SECT10">
<h2 class="SECT10"><a id="COMMAND_HEAD" name="COMMAND_HEAD">3.10 The command head</a></h2>
<p>
head shows the first lines of files.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=head&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 10: Simple example for the usage of the command head</b></p>
<div class="CODELISTING">
  <pre>
  head -n5 <tt class="FILENAME">big_file</tt> # shows the first 5 lines of big_file
  </pre>
</div>
</div>


<div class="SECT11">
<h2 class="SECT11"><a id="COMMAND_TAIL" name="COMMAND_TAIL">3.11 The command tail</a></h2>
<p>
The utility tails displays the last lines of files.<br>
<a href="http://www.freebsd.org/cgi/man.cgi?query=tail&apropos=0&sektion=0&manpath=FreeBSD+7.0-RELEASE&format=html">
See the manpage for further details.
</a>
</p>
<p><b>code listing 11: Simple example for the usage of the command tail</b></p>
<div class="CODELISTING">
  <pre>
  tail -n5 <tt class="FILENAME">big_file</tt> # shows the last 5 lines of big_file
  </pre>
</div>
</div>


</body>
</html>